// This file is part of Acala.

// Copyright (C) 2020-2025 Acala Foundation.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Autogenerated weights for module_homa
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-07-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024

// Executed Command:
// target/release/acala
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=module_homa
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./modules/homa/src/weights.rs
// --template=./templates/module-weight-template.hbs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(clippy::unnecessary_cast)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for module_homa.
pub trait WeightInfo {
	fn on_initialize() -> Weight;
	fn on_initialize_with_bump_era(n: u32,) -> Weight;
	fn mint() -> Weight;
	fn request_redeem() -> Weight;
	fn fast_match_redeems(n: u32, ) -> Weight;
	fn claim_redemption() -> Weight;
	fn update_homa_params() -> Weight;
	fn update_bump_era_params() -> Weight;
	fn reset_ledgers(n: u32, ) -> Weight;
	fn reset_current_era() -> Weight;
}

/// Weights for module_homa using the Acala node and recommended hardware.
pub struct AcalaWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for AcalaWeight<T> {
	// Storage: ParachainSystem ValidationData (r:1 w:0)
	// Storage: Homa LastEraBumpedBlock (r:1 w:0)
	// Storage: Homa BumpEraFrequency (r:1 w:0)
	fn on_initialize() -> Weight {
		Weight::from_parts(5_281_000, 0)
			.saturating_add(T::DbWeight::get().reads(3 as u64))
	}
	// Storage: ParachainSystem ValidationData (r:1 w:0)
	// Storage: Homa LastEraBumpedBlock (r:1 w:1)
	// Storage: Homa BumpEraFrequency (r:1 w:0)
	// Storage: Homa RelayChainCurrentEra (r:1 w:1)
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa EstimatedRewardRatePerEra (r:1 w:0)
	// Storage: Homa StakingLedgers (r:2 w:1)
	// Storage: Homa TotalStakingBonded (r:1 w:1)
	// Storage: Homa CommissionRate (r:1 w:0)
	// Storage: Tokens TotalIssuance (r:2 w:2)
	// Storage: Tokens Accounts (r:3 w:3)
	// Storage: System Account (r:2 w:2)
	// Storage: XcmInterface XcmDestWeightAndFee (r:4 w:0)
	// Storage: ParachainInfo ParachainId (r:1 w:0)
	// Storage: ParachainSystem HostConfiguration (r:1 w:0)
	// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
	// Storage: Homa UnclaimedRedemption (r:1 w:1)
	// Storage: Homa ToBondPool (r:1 w:1)
	// Storage: Homa SoftBondedCapPerSubAccount (r:1 w:0)
	// Storage: UnknownTokens ConcreteFungibleBalances (r:1 w:0)
	// Storage: Homa RedeemRequests (r:2 w:1)
	// Storage: Homa Unbondings (r:1 w:1)
	// Storage: Homa TotalVoidLiquid (r:0 w:1)
	fn on_initialize_with_bump_era(n: u32,) -> Weight {
		Weight::from_parts(253_506_000, 0)
			.saturating_add(T::DbWeight::get().reads(31 as u64))
			.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(n as u64)))
			.saturating_add(T::DbWeight::get().writes(18 as u64))
			.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(n as u64)))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa TotalStakingBonded (r:1 w:0)
	// Storage: Homa ToBondPool (r:1 w:1)
	// Storage: Homa SoftBondedCapPerSubAccount (r:1 w:0)
	// Storage: Tokens Accounts (r:3 w:3)
	// Storage: System Account (r:1 w:1)
	// Storage: Tokens TotalIssuance (r:1 w:1)
	// Storage: Homa TotalVoidLiquid (r:1 w:1)
	// Storage: Homa EstimatedRewardRatePerEra (r:1 w:0)
	fn mint() -> Weight {
		Weight::from_parts(88_950_000, 0)
			.saturating_add(T::DbWeight::get().reads(11 as u64))
			.saturating_add(T::DbWeight::get().writes(8 as u64))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa RedeemRequests (r:1 w:1)
	// Storage: Tokens Accounts (r:2 w:2)
	// Storage: System Account (r:1 w:1)
	fn request_redeem() -> Weight {
		Weight::from_parts(53_493_000, 0)
			.saturating_add(T::DbWeight::get().reads(5 as u64))
			.saturating_add(T::DbWeight::get().writes(5 as u64))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa RedeemRequests (r:1 w:1)
	// Storage: Homa ToBondPool (r:1 w:1)
	// Storage: Homa TotalStakingBonded (r:1 w:0)
	// Storage: Tokens TotalIssuance (r:1 w:1)
	// Storage: Homa TotalVoidLiquid (r:1 w:0)
	// Storage: Homa FastMatchFeeRate (r:1 w:0)
	// Storage: Tokens Accounts (r:3 w:3)
	// Storage: System Account (r:2 w:2)
	fn fast_match_redeems(n: u32, ) -> Weight {
		Weight::from_parts(7_082_000, 0)
			// Standard Error: 88_000
			.saturating_add(Weight::from_parts(63_412_000, 0).saturating_mul(n as u64))
			.saturating_add(T::DbWeight::get().reads(9 as u64))
			.saturating_add(T::DbWeight::get().reads((3 as u64).saturating_mul(n as u64)))
			.saturating_add(T::DbWeight::get().writes(6 as u64))
			.saturating_add(T::DbWeight::get().writes((3 as u64).saturating_mul(n as u64)))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa RelayChainCurrentEra (r:1 w:0)
	// Storage: Homa Unbondings (r:2 w:1)
	// Storage: Homa UnclaimedRedemption (r:1 w:1)
	// Storage: Tokens Accounts (r:2 w:2)
	// Storage: System Account (r:2 w:2)
	// Storage: EvmAccounts EvmAddresses (r:1 w:0)
	fn claim_redemption() -> Weight {
		Weight::from_parts(75_705_000, 0)
			.saturating_add(T::DbWeight::get().reads(10 as u64))
			.saturating_add(T::DbWeight::get().writes(7 as u64))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa SoftBondedCapPerSubAccount (r:0 w:1)
	// Storage: Homa FastMatchFeeRate (r:0 w:1)
	// Storage: Homa CommissionRate (r:0 w:1)
	// Storage: Homa EstimatedRewardRatePerEra (r:0 w:1)
	fn update_homa_params() -> Weight {
		Weight::from_parts(25_806_000, 0)
			.saturating_add(T::DbWeight::get().reads(1 as u64))
			.saturating_add(T::DbWeight::get().writes(5 as u64))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa LastEraBumpedBlock (r:0 w:1)
	// Storage: Homa BumpEraFrequency (r:0 w:1)
	fn update_bump_era_params() -> Weight {
		Weight::from_parts(16_926_000, 0)
			.saturating_add(T::DbWeight::get().reads(1 as u64))
			.saturating_add(T::DbWeight::get().writes(3 as u64))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa StakingLedgers (r:1 w:1)
	// Storage: Homa TotalStakingBonded (r:1 w:1)
	fn reset_ledgers(n: u32, ) -> Weight {
		Weight::from_parts(9_399_000, 0)
			// Standard Error: 72_000
			.saturating_add(Weight::from_parts(10_515_000, 0).saturating_mul(n as u64))
			.saturating_add(T::DbWeight::get().reads(2 as u64))
			.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(n as u64)))
			.saturating_add(T::DbWeight::get().writes(2 as u64))
			.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(n as u64)))
	}
	// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
	// Storage: Homa RelayChainCurrentEra (r:1 w:1)
	fn reset_current_era() -> Weight {
		Weight::from_parts(14_275_000, 0)
			.saturating_add(T::DbWeight::get().reads(2 as u64))
			.saturating_add(T::DbWeight::get().writes(2 as u64))
	}
}

// For backwards compatibility and tests
impl WeightInfo for () {
	fn on_initialize() -> Weight {
		Weight::from_parts(5_281_000, 0)
			.saturating_add(RocksDbWeight::get().reads(3 as u64))
	}
	fn on_initialize_with_bump_era(n: u32,) -> Weight {
		Weight::from_parts(253_506_000, 0)
			.saturating_add(RocksDbWeight::get().reads(31 as u64))
			.saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(n as u64)))
			.saturating_add(RocksDbWeight::get().writes(18 as u64))
			.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(n as u64)))
	}
	fn mint() -> Weight {
		Weight::from_parts(88_950_000, 0)
			.saturating_add(RocksDbWeight::get().reads(11 as u64))
			.saturating_add(RocksDbWeight::get().writes(8 as u64))
	}
	fn request_redeem() -> Weight {
		Weight::from_parts(53_493_000, 0)
			.saturating_add(RocksDbWeight::get().reads(5 as u64))
			.saturating_add(RocksDbWeight::get().writes(5 as u64))
	}
	fn fast_match_redeems(n: u32, ) -> Weight {
		Weight::from_parts(7_082_000, 0)
			// Standard Error: 88_000
			.saturating_add(Weight::from_parts(63_412_000, 0).saturating_mul(n as u64))
			.saturating_add(RocksDbWeight::get().reads(9 as u64))
			.saturating_add(RocksDbWeight::get().reads((3 as u64).saturating_mul(n as u64)))
			.saturating_add(RocksDbWeight::get().writes(6 as u64))
			.saturating_add(RocksDbWeight::get().writes((3 as u64).saturating_mul(n as u64)))
	}
	fn claim_redemption() -> Weight {
		Weight::from_parts(75_705_000, 0)
			.saturating_add(RocksDbWeight::get().reads(10 as u64))
			.saturating_add(RocksDbWeight::get().writes(7 as u64))
	}
	fn update_homa_params() -> Weight {
		Weight::from_parts(25_806_000, 0)
			.saturating_add(RocksDbWeight::get().reads(1 as u64))
			.saturating_add(RocksDbWeight::get().writes(5 as u64))
	}
	fn update_bump_era_params() -> Weight {
		Weight::from_parts(16_926_000, 0)
			.saturating_add(RocksDbWeight::get().reads(1 as u64))
			.saturating_add(RocksDbWeight::get().writes(3 as u64))
	}
	fn reset_ledgers(n: u32, ) -> Weight {
		Weight::from_parts(9_399_000, 0)
			// Standard Error: 72_000
			.saturating_add(Weight::from_parts(10_515_000, 0).saturating_mul(n as u64))
			.saturating_add(RocksDbWeight::get().reads(2 as u64))
			.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(n as u64)))
			.saturating_add(RocksDbWeight::get().writes(2 as u64))
			.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(n as u64)))
	}
	fn reset_current_era() -> Weight {
		Weight::from_parts(14_275_000, 0)
			.saturating_add(RocksDbWeight::get().reads(2 as u64))
			.saturating_add(RocksDbWeight::get().writes(2 as u64))
	}
}
